package com.li.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.li.result.Result;
import com.li.service.OperLogService;
import com.li.system.SysOperLog;
import com.li.vo.SysOperLogQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("操作日志")
@RestController
@RequestMapping("/admin/system/sysOperLog")
public class SysOperLogController {
    @Autowired
    private OperLogService operLogService;

    @PreAuthorize("hasAuthority('bnt.sysOperLog.list')")
    @ApiOperation(value = "获取分页列表")
    @GetMapping("{page}/{limit}")
    public Result list(@PathVariable Long page, @PathVariable Long limit, SysOperLogQueryVo sysOperLogQueryVo) {

        IPage<SysOperLog> pageModel = operLogService.selectPage(page, limit, sysOperLogQueryVo);
        return Result.ok(pageModel);
    }

    @PreAuthorize("hasAuthority('bnt.sysOperLog.list')")
    @ApiOperation(value = "获取")
    @GetMapping("get/{id}")
    public Result get(@PathVariable Long id){
        SysOperLog sysOperLog = operLogService.getById(id);
        return Result.ok(sysOperLog);
    }


}
